﻿using System;
using System.Collections.Generic;
using System.Linq;
using Model.User;
using Model.Course;
using Model.Communication;

namespace Controller
{
    public static class CourseController
    {
        public static void viewCourse (object course)        
        {
            
        }

        public static Course[] viewCourses()        
        {
            Course[] courses = Course.getAll();
            return courses;
        }

        public static void singInToCourse(object courseId, object studentId)        
        {
            
        }
        public static void singOutFromCourse(object course)        
        {
            
        }
        public static Course createCourse(String name, String description, Teacher lecturer)        
        {
            Course c = Course.create(name, description, lecturer);
            Forum.create(c);

            return c;
        }

        public static void deleteCourse(int courseId)        
        {
            Course c = Course.get(courseId);
           // Forum.get(c).delete();
           // c.delete();
        }

        public static Lecture createLecture(int courseId, string name, string content, Attachment[] att)
        {
            Lecture l = Lecture.create(Course.get(courseId), name, DateTime.Now, content);

            if (att != null)
            {
                foreach (var a in att)
                {
                    l.addAttachment(a);
                }
            }

            return l;
        }



        public static void accepStudent(object student)        
        {
            
        }
    }
}